package com.idas.comp;

public class UserPermissions {

	private static final int CREATE_USER = 1;
	private static final int MODIFY_USER = 2;
	private static final int DELETE_USER = 4;
	private static final int CREATE_MODULE = 8;
	private static final int MODIFY_MODULE = 16;
	private static final int DELETE_MODULE = 32;
	private static final int CREATE_EXPENSE = 64;
	private static final int MODIFY_EXPENSE = 128;
	private static final int DELETE_EXPENSE = 256;

	private boolean createUser;
	private boolean modifyUser;
	private boolean deleteUser;
	private boolean createModule;
	private boolean modifyModule;
	private boolean deleteModule;
	private boolean createExpense;
	private boolean modifyExpense;
	private boolean deleteExpense;

	public UserPermissions() {
	}

	protected UserPermissions(int pVal) {
		setCreateUser(((pVal & CREATE_USER)==CREATE_USER) ? true : false);
		setModifyUser(((pVal & MODIFY_USER)==MODIFY_USER) ? true : false);
		setDeleteUser(((pVal & DELETE_USER)==DELETE_USER) ? true : false);
		setCreateModule(((pVal & CREATE_MODULE)==CREATE_MODULE) ? true : false);
		setModifyModule(((pVal & MODIFY_MODULE)==MODIFY_MODULE) ? true : false);
		setDeleteModule(((pVal & DELETE_MODULE)==DELETE_MODULE) ? true : false);
		setCreateExpense(((pVal & CREATE_EXPENSE)==CREATE_EXPENSE) ? true : false);
		setModifyExpense(((pVal & MODIFY_EXPENSE)==MODIFY_EXPENSE) ? true : false);
		setDeleteExpense(((pVal & DELETE_EXPENSE)==DELETE_EXPENSE) ? true : false);
	}

	public boolean isCreateUser() {
		return createUser;
	}

	public void setCreateUser(boolean createUser) {
		this.createUser = createUser;
	}

	public boolean isModifyUser() {
		return modifyUser;
	}

	public void setModifyUser(boolean modifyUser) {
		this.modifyUser = modifyUser;
	}

	public boolean isDeleteUser() {
		return deleteUser;
	}

	public void setDeleteUser(boolean deleteUser) {
		this.deleteUser = deleteUser;
	}

	public boolean isCreateModule() {
		return createModule;
	}

	public void setCreateModule(boolean createModule) {
		this.createModule = createModule;
	}

	public boolean isModifyModule() {
		return modifyModule;
	}

	public void setModifyModule(boolean modifyModule) {
		this.modifyModule = modifyModule;
	}

	public boolean isDeleteModule() {
		return deleteModule;
	}

	public void setDeleteModule(boolean deleteModule) {
		this.deleteModule = deleteModule;
	}

	public boolean isCreateExpense() {
		return createExpense;
	}

	public void setCreateExpense(boolean createExpense) {
		this.createExpense = createExpense;
	}

	public boolean isModifyExpense() {
		return modifyExpense;
	}

	public void setModifyExpense(boolean modifyExpense) {
		this.modifyExpense = modifyExpense;
	}

	public boolean isDeleteExpense() {
		return deleteExpense;
	}

	public void setDeleteExpense(boolean deleteExpense) {
		this.deleteExpense = deleteExpense;
	}

}
